.prompt-library-container {
  width: 100%;
  height: 100%;
}

.prompt-library-filters {
  margin-bottom: 16px;
}

.prompt-library-content {
  padding: 16px 0;
}

/* 模板卡片样式 - 网格视图 */
.prompt-template-card {
  height: 100%;
  transition: all 0.3s ease;
  border: 1px solid #f0f0f0;
}

.prompt-template-card:hover {
  border-color: #1890ff;
  box-shadow: 0 4px 12px rgba(24, 144, 255, 0.15);
  transform: translateY(-2px);
}

.prompt-template-card.current {
  border-color: #52c41a;
  background: linear-gradient(to bottom, rgba(82, 196, 26, 0.02), transparent);
}

.prompt-template-card .ant-card-body {
  padding: 16px;
  height: 200px;
  display: flex;
  flex-direction: column;
}

.prompt-template-card .ant-card-meta {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.prompt-template-card .ant-card-meta-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.template-card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.template-card-title span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 500;
  color: #262626;
}

.template-card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-description {
  flex: 1;
  color: #595959;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: ellipsis;
}

.template-meta {
  min-height: 24px;
}

.template-tag {
  font-size: 12px;
  margin: 0;
}

.template-stats {
  font-size: 12px;
  color: #8c8c8c;
  margin-top: auto;
}

.template-stats span {
  margin-right: 12px;
}

.template-stats .anticon {
  margin-right: 4px;
}

/* 模板列表样式 - 列表视图 */
.prompt-template-list-item {
  margin-bottom: 0;
  transition: all 0.3s ease;
}

.prompt-template-list-item:hover {
  border-color: #1890ff;
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
}

.prompt-template-list-item.current {
  border-color: #52c41a;
  background: linear-gradient(to right, rgba(82, 196, 26, 0.02), transparent);
}

.template-list-name {
  font-size: 16px;
  font-weight: 500;
  color: #262626;
}

.template-list-description {
  color: #595959;
  font-size: 14px;
  margin: 4px 0 8px;
}

.template-stats-vertical {
  text-align: center;
  font-size: 12px;
  color: #8c8c8c;
}

.template-stats-vertical div {
  margin: 2px 0;
}

/* 收藏图标 */
.favorite-icon {
  transition: all 0.3s ease;
}

.favorite-icon:hover {
  color: #faad14;
  transform: scale(1.2);
}

.favorite-icon.active {
  color: #faad14;
}

.favorite-active {
  color: #faad14;
  border-color: #faad14;
}

/* 筛选标签 */
.filter-tag {
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.filter-tag:hover {
  opacity: 0.8;
}

.filter-tag.active {
  background-color: #1890ff;
  color: white;
  border-color: #1890ff;
}

/* 预览内容 */
.preview-content {
  background: #fafafa;
  border: 1px solid #f0f0f0;
  max-height: 400px;
  overflow-y: auto;
}

.preview-content pre {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
}

/* 详情Drawer */
.template-detail-section {
  margin-bottom: 0;
}

.template-detail-section h4 {
  margin-bottom: 12px;
  color: #262626;
  font-weight: 500;
}

.template-detail-section > div {
  margin: 8px 0;
  color: #595959;
}

.template-prompt-preview {
  background: #fafafa;
  border: 1px solid #f0f0f0;
  padding: 12px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
}

.variable-item {
  padding: 8px 12px;
  background: #fafafa;
  border: 1px solid #f0f0f0;
  border-radius: 4px;
}

.variable-type {
  margin-left: 8px;
  color: #8c8c8c;
  font-size: 12px;
}

.variable-desc {
  margin-top: 4px;
  font-size: 13px;
  color: #595959;
}

.variable-default {
  margin-top: 4px;
  font-size: 12px;
  color: #8c8c8c;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .prompt-template-card .ant-card-body {
    padding: 12px;
    height: 180px;
  }
  
  .template-card-title span {
    font-size: 14px;
  }
  
  .template-description {
    font-size: 12px;
    -webkit-line-clamp: 3;
  }
  
  .template-stats {
    font-size: 11px;
  }
  
  .template-list-name {
    font-size: 14px;
  }
  
  .template-list-description {
    font-size: 12px;
  }
}

/* 加载动画 */
.prompt-library-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

/* Empty状态 */
.ant-empty {
  margin: 60px 0;
}

/* 卡片操作区域 */
.prompt-template-card .ant-card-actions {
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
}

.prompt-template-card .ant-card-actions > li {
  margin: 8px 0;
}

.prompt-template-card .ant-card-actions > li > span {
  display: block;
  width: 100%;
  padding: 0;
  cursor: pointer;
  transition: color 0.3s ease;
}

.prompt-template-card .ant-card-actions > li > span:hover {
  color: #1890ff;
}

/* 分段控制器样式 */
.ant-segmented {
  background: #f0f0f0;
}

.ant-segmented .ant-segmented-item-selected {
  background: white;
}

/* 搜索框样式 */
.ant-input-search {
  .ant-input-prefix {
    color: #8c8c8c;
  }
}

/* 标签颜色映射 */
.ant-tag-blue {
  background: #e6f7ff;
  border-color: #91d5ff;
  color: #1890ff;
}

.ant-tag-green {
  background: #f6ffed;
  border-color: #b7eb8f;
  color: #52c41a;
}

.ant-tag-purple {
  background: #f9f0ff;
  border-color: #d3adf7;
  color: #722ed1;
}

.ant-tag-orange {
  background: #fff7e6;
  border-color: #ffd591;
  color: #fa8c16;
}

/* 滚动条样式 */
.preview-content::-webkit-scrollbar,
.template-prompt-preview::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.preview-content::-webkit-scrollbar-thumb,
.template-prompt-preview::-webkit-scrollbar-thumb {
  background: #d9d9d9;
  border-radius: 3px;
}

.preview-content::-webkit-scrollbar-thumb:hover,
.template-prompt-preview::-webkit-scrollbar-thumb:hover {
  background: #bfbfbf;
}

.preview-content::-webkit-scrollbar-track,
.template-prompt-preview::-webkit-scrollbar-track {
  background: transparent;
}

/* 按钮组样式 */
.ant-space-compact {
  display: inline-flex;
}

/* Badge样式 */
.ant-badge-ribbon {
  font-size: 12px;
}

.ant-badge-ribbon.ant-badge-ribbon-placement-end {
  right: -8px;
  border-radius: 0 4px 0 4px;
}